package com.sevennotes.classtable.data.database.daos

import androidx.lifecycle.LiveData
import androidx.room.*
import com.sevennotes.classtable.model.StudentItem

@Dao
interface StudentItemDAO {

  @Insert
  fun insertStudentItem(studentItem: StudentItem): Long

  @Update
  fun updateStudentItem(studentItem: StudentItem)

  @Delete
  fun deleteStudentItem(studentItem: StudentItem)

  @Query("DELETE FROM student_items")
  fun clear()

  @Query("SELECT * FROM student_items")
  fun getAllStudentItemsForBack(): List<StudentItem>

  @Query("SELECT * FROM student_items")
  fun getAllStudentItems(): LiveData<List<StudentItem>>

  @Query("SELECT * FROM student_items WHERE id IS :id")
  fun getStudentItemById(id: Int): StudentItem?

}